from 陕西省企业详情 import readAllFile
import urllib.request
def getURL(enid,name,org_code):
#     data_string=urllib.parse.urlencode(name)
    data = {"enid": enid,
        "name": name,
        "org_code": org_code,
        "type":"",}
    data_string=urllib.parse.urlencode(data)
    return f"http://jzscyth.shaanxi.gov.cn:7001/PDR/network/Enterprise/Informations/view?{data_string}"
    
if __name__ == "__main__":
    alldata = readAllFile()
    filename = "企业_17_安康高新华香商混有限公司_58351477-4"
    filenameArr = filename.split("_")
    for x in range(0,len(alldata)):
        companyArr = alldata[x].replace("'","").replace(" ","").split(",")
        if len(companyArr) == 4:
            if companyArr[0] == filenameArr[2] and companyArr[2] == filenameArr[3]:
                print(getURL(companyArr[1], companyArr[0], companyArr[2]))
                